'use strict';

const Controller = require('egg').Controller;

class UserController extends Controller {
    async registry() {
        let {ctx,service} = this;
        let {username,password} = ctx.request.body;
        //排重  
        if(username && password){
            try{
                await service.user.registry(username,password);
                ctx.body = {code:1,msg:"注册成功"}
            }catch(e){
                ctx.body = {
                    code:0,
                    msg:e
                }
            }
        }else{
            ctx.body = {
                code:2,
                msg:'参数有误'
            }
        }
        
    }

    async fn(){
        
    }
}

module.exports = UserController;

//注：post put传递的参数一定要记得关闭csrf防范  config/config.default.js

